package com.act262.vote.utils;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;

import com.act262.vote.bean.Params;
import com.act262.vote.bean.Rule;

public class VoteCore {
	/**
	 * 投票的post方法
	 * 
	 * @param userName
	 *            学号
	 * @param userPw
	 *            密码
	 * @param numberList
	 *            需要投票的编号,数目为1~6个
	 */
	public static synchronized String vote(String userName, String userPw,
			List<String> numberList) {
		HttpClient httpClient = new DefaultHttpClient();

		HttpPost post = new HttpPost("http://2014.comp.pc.hstc.cn/Vote.aspx");
		post.setHeader("Content-Type",
				"application/x-www-form-urlencoded; charset=UTF-8");
		post.setHeader("Referer", "http://2014.comp.pc.hstc.cn/Vote.aspx");
		// 这个是关键的,少了user agent 访问就会失败
		post.setHeader(
				"User-Agent",
				"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1");
		post.setHeader("X-MicrosoftAjax", "Delta=true");
		post.setHeader("X-Requested-With", "XMLHttpRequest");

		ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ScriptManager1",
				"ctl00$ContentPlaceHolder2$ScriptManager1|ctl00$ContentPlaceHolder2$ImageButton1"));
		params.add(new BasicNameValuePair("__EVENTTARGET", ""));
		params.add(new BasicNameValuePair("__EVENTARGUMENT", ""));
		for (String number : numberList) {
			params.add(new BasicNameValuePair(
					"ctl00$ContentPlaceHolder2$Repeater1$ctl" + number
							+ "$AddVote", "on"));
		}

		params.add(new BasicNameValuePair("ctl00$ContentPlaceHolder2$txtUser",
				userName));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$txtPasswd", userPw));

		// 根据网页投票时选中的数据
		params.add(new BasicNameValuePair(
				"__VIEWSTATE",
				"/wEPDwULLTE2NTI2ODE4NDgPZBYCZg9kFgICAw9kFgICAQ9kFgQCAw8PZA8QFgFmFgEWAh4OUGFyYW1ldGVyVmFsdWVkFgECA2RkAgUPZBYCZg9kFgICAQ8WAh4LXyFJdGVtQ291bnQCLRZaZg9kFggCAQ8PFgIeBFRleHQFAzE5NmRkAgIPFQUmaHR0cDovLzIwMTQuY29tcC5wYy5oc3RjLmNuLzIwMTMxOTExMjkP6Zy56Zuz5biD6KKL5oiPFy8yMDEzMTkxMTI5L2RlZmF1bHQuanBnJmh0dHA6Ly8yMDE0LmNvbXAucGMuaHN0Yy5jbi8yMDEzMTkxMTI5D+mcuembs+W4g+iii+aIj2QCAw8PFgIfAgUBMGRkAgYPFQGBAemcuembs+W4g+iii+aIj++8jOWboOWFtuavj+WHuuWJp+WQjeeahuacieKAnOmcuembs+KAneS6jOWtl+W+l+ensO+8jOaYr+WPsOa5vuiRl+WQjeasoeaWh+WMluS5i+S4gOOAguS7peWFtui3jOWulei1t+S8j+eahOWJp+aDhWQCAQ9kFggCAQ8PFgIfAgUDMTk3ZGQCAg8VBSZodHRwOi8vMjAxNC5jb21wLnBjLmhzdGMuY24vMjAxMjE3NzIxMxLjgIrmva7lt57lhavmma/jgIsXLzIwMTIxNzcyMTMvZGVmYXVsdC5qcGcmaHR0cDovLzIwMTQuY29tcC5wYy5oc3RjLmNuLzIwMTIxNzcyMTMS44CK5r2u5bee5YWr5pmv44CLZAIDDw8WAh8CBQEwZGQCBg8VAYEB5r2u5bee5YWr5pmv5pen5pe25pyJ5YaF5aSW5LmL5YiG77yM5YaF5YWr5pmv5piv5oyH5LqO5Y+k5Z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ameValuePair("__VIEWSTATEGENERATOR", "8DD11970"));

		// 改变
		params.add(new BasicNameValuePair(
				"__EVENTVALIDATION",
				"/wEWMQL94/7VCAKr8ufRAgKq6ufRAgKtpOjRAgKsnOjRAgKXzufRAgKWxufRAgKZgOjRAgKY+OfRAgKjrufRAgKipufRAgKr8vuMAgKq6vuMAgKtpPyMAgKsnPyMAgKXzvuMAgKWxvuMAgKZgPyMAgKY+PuMAgKjrvuMAgKipvuMAgKr8q/xDQKq6q/xDQKtpLDxDQKsnLDxDQKXzq/xDQKWxq/xDQKZgLDxDQKY+K/xDQKjrq/xDQKipq/xDQKr8qPTBwKq6qPTBwKtpKTTBwKsnKTTBwKXzqPTBwKWxqPTBwKZgKTTBwKY+KPTBwKjrqPTBwKipqPTBwKr8pflCgKq6pflCgKtpJjlCgKsnJjlCgKXzpflCgKm3NXxBQLRmdvlAgKKnvb7DECWLafROlBsgRd9MllaOXOOo5tgxWCBymHCZ8atdmEs"));

		params.add(new BasicNameValuePair("__ASYNCPOST", "true"));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ImageButton1.x", "42"));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ImageButton1.y", "13"));
		for (BasicNameValuePair p : params) {
			System.out.println(p.toString());
		}

		HttpResponse response = null;
		try {
			post.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
			response = httpClient.execute(post);
			HttpEntity entity = response.getEntity();
			if (null != entity) {
				String content = EntityUtils.toString(entity);
				System.out.println(content);
				if (content.contains("投票成功")) {
					try {
						Thread.sleep(2000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					return "学号: " + userName + "    -------->  投票成功啦";
				} else {
					return "学号: " + userName + "    -------->  投票失败啦";
				}
			} else {
				System.out.println("服务器错误了");
				return "学号:" + userName + "   投票失败";
			}
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			post.abort();
			post = null;
			httpClient.getConnectionManager().shutdown();
			httpClient = null;
		}
		return "学号:" + userName + "    -------->  投票失败";

	}

	/**
	 * 核心方法,
	 * 
	 * @param mHttpClient
	 * @param rule
	 *            参数列表:包括基础的用户名,密码,投票的编号1~6个,其他参数如果没有则使用默认的
	 * @return
	 */
	public static String vote(CloseableHttpClient httpClient, Rule rule) {

		String result = "#! 网络故障  !#";

		CloseableHttpResponse response = null;

		HttpPost httpPost = new HttpPost(
				"http://2014.comp.pc.hstc.cn/Vote.aspx");

		httpPost.setHeader("Content-Type",
				"application/x-www-form-urlencoded; charset=UTF-8");
		httpPost.setHeader("Referer", "http://2014.comp.pc.hstc.cn/Vote.aspx");
		// 这个是关键的,少了user agent 访问就会失败
		httpPost.setHeader(
				"User-Agent",
				"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1");
		httpPost.setHeader("X-MicrosoftAjax", "Delta=true");
		httpPost.setHeader("X-Requested-With", "XMLHttpRequest");

		ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ScriptManager1",
				"ctl00$ContentPlaceHolder2$ScriptManager1|ctl00$ContentPlaceHolder2$ImageButton1"));
		params.add(new BasicNameValuePair("__EVENTTARGET", ""));
		params.add(new BasicNameValuePair("__EVENTARGUMENT", ""));

		// 参赛编号
		for (int i = 1; i <= 6; i++) {

			if (!(rule.getValue(Params.AddVote_0 + i) == null || rule.getValue(
					Params.AddVote_0 + i).equals(""))) {
				params.add(new BasicNameValuePair(String.format(
						Params.$AddVote, rule.getValue(Params.AddVote_0 + i)),
						"on")); // 关键参数
			}
		}

		// 用户账号密码
		params.add(new BasicNameValuePair("ctl00$ContentPlaceHolder2$txtUser",
				rule.getValue(Params.USER_NAME)));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$txtPasswd", rule
						.getValue(Params.USER_PW)));

		// 根据网页投票时选中的数据,根据浏览器生成的动态数据
		params.add(new BasicNameValuePair(
				"__VIEWSTATE",
				rule.getValue(Params.__VIEWSTATE) == null
						|| rule.getValue(Params.__VIEWSTATE).equals("") ? Params.DEFAULT_VIEWSTATE
						: rule.getValue(Params.__VIEWSTATE)));

		// 根据浏览器生成的动态数据
		params.add(new BasicNameValuePair(
				"__EVENTVALIDATION",
				rule.getValue(Params.__EVENTVALIDATION) == null
						|| rule.getValue(Params.__EVENTVALIDATION).equals("") ? Params.DEFAULT_EVENTVALIDATION
						: rule.getValue(Params.__EVENTVALIDATION)));

		params.add(new BasicNameValuePair("__VIEWSTATEGENERATOR", "8DD11970"));
		params.add(new BasicNameValuePair("__ASYNCPOST", "true"));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ImageButton1.x", Math.random() * 10 // 按钮位置,
						+ ""));
		params.add(new BasicNameValuePair(
				"ctl00$ContentPlaceHolder2$ImageButton1.y", Math.random() * 10 // 按钮位置
						+ ""));

		// 测试参数
		for (BasicNameValuePair p : params) {
			System.out.println(p.toString());
		}

		try {
			System.out.println("XXXX");
			httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
			response = httpClient.execute(httpPost);

			HttpEntity entity = response.getEntity();
			if (null != entity) {
				String content = EntityUtils.toString(entity);

				if (content.contains("投票成功")) {
					result = "学号 : " + rule.getValue(Params.USER_NAME)
							+ "  ------  投票成功!";
				} else if (content.contains("您已经投过票，请勿重复投票")) {
					result = "学号 : " + rule.getValue(Params.USER_NAME)
							+ "  ------  已经投过票";
				} else if (content.contains("用户名或者密码检测错误")) {
					result = "学号 : " + rule.getValue(Params.USER_NAME)
							+ "  ------  用户名或者密码错误!";
				} else if (content.contains("0|error|500||")) {
					result = "服务器内部错误!";
				} else {
					result = "学号 : " + rule.getValue(Params.USER_NAME)
							+ "  ------  投票失败啦!";
				}

				// System.out.println(content);
			} else {
				result = "网络出问题了!";
			}
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return result;
		} catch (ClientProtocolException e) {
			e.printStackTrace();
			return result;
		} catch (IOException e) {
			e.printStackTrace();
			return result;
		}

		System.out.println(result);
		return result;
	}
}
